/*
 * RedThreshConfig.cpp
 *
 *  Created on: 16/lug/2014
 *      Author: va2013
 */

#include "RedThreshConfig.h"

RedThreshConfig::RedThreshConfig() :
		HSVThreshConfig() {
	H_MIN_m = -0.041999221;
	H_MIN_b = 162.6799724;
	H_MAX_m = -0.031352472;
	H_MAX_b = 188.8203548;
	S_MIN_m1 = 0;
	S_MIN_b1 = 185;
	S_MIN_m2 = 0.995864571;
	S_MIN_b2 = 214.8191499;
	S_MIN_gamma = 100;
	S_MAX_m = 0.999034236;
	S_MAX_b = 300.8971482;
	V_MIN_m1 = 0.592614818;
	V_MIN_b1 = -1.26248972;
	V_MIN_m2 = 0.792614818;
	V_MIN_b2 = -16.26248972;
	V_MIN_gamma = 125;
	V_MAX_m1 = 1.407607137;
	V_MAX_b1 = 22.81789968;
	V_MAX_m2 = 0.907607137;
	V_MAX_b2 = 57.81789968;
	V_MAX_gamma = 125;

//	H_MIN_m = -0.041999221;
//	H_MIN_b = 167.6799724;
//	H_MAX_m = -0.031352472;
//	H_MAX_b = 188.8203548;
//	S_MIN_m1 = 0;
//	S_MIN_b1 = 185;
//	S_MIN_m2 = 0.995864571;
//	S_MIN_b2 = 214.8191499;
//	S_MIN_gamma = 120;
//	S_MAX_m = 0.999034236;
//	S_MAX_b = 300.8971482;
//	V_MIN_m = 0.792614818;
//	V_MIN_b = -16.26248972;
//	V_MAX_m = 1.007607137;
//	V_MAX_b = 42.81789968;

}

RedThreshConfig::~RedThreshConfig() {
	// TODO Auto-generated destructor stub
}

double RedThreshConfig::getHMax(double mean) {
	return getLinThreshValue(H_MAX_m, H_MAX_b, mean);
}

double RedThreshConfig::getHMin(double mean) {
	return getLinThreshValue(H_MIN_m, H_MIN_b, mean);
}

double RedThreshConfig::getSMax(double mean) {
	return getExpThreshValue(S_MAX_m, S_MAX_b, mean);
}

double RedThreshConfig::getSMin(double mean) {
	if (mean < S_MIN_gamma)
		return getLinThreshValue(S_MIN_m1, S_MIN_b1, mean);
	else
		return getExpThreshValue(S_MIN_m2, S_MIN_b2, mean);
}

double RedThreshConfig::getVMax(double mean) {
	if (mean < V_MAX_gamma)
		return getLinThreshValue(V_MAX_m1, V_MAX_b1, mean);
	else
		return getLinThreshValue(V_MAX_m2, V_MAX_b2, mean);
}

double RedThreshConfig::getVMin(double mean) {
	if (mean < V_MIN_gamma)
		return getLinThreshValue(V_MIN_m1, V_MIN_b1, mean);
	else
		return getLinThreshValue(V_MIN_m2, V_MIN_b2, mean);
}

